#include "communicate.hpp"
#include "log.hpp"

using namespace std;

int main()
{
    Log log;
    //打开管道
    int fd = open("./myfifo", O_WRONLY);
    if(fd < 0)
    {
        log(Fatal, "%s", strerror(errno));
        return -1;
    }

    //进行通信
   while(1)
   {
        string ord;
        cout << "Input:";
        getline(cin, ord);
        write(fd, ord.c_str(), ord.size());
   }

   close(fd);
   return 0;
}